package com.weayer.controller;

import com.weayer.dto.ResponseResult;
import com.weayer.request.VerificationCodeDTO;
import com.weayer.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @description: Service服务 - 鉴权 - 用户controller
 * @author: Weayer
 **/
@RestController
public class UserController {
    @Autowired
    UserService userService;

    @PostMapping("/user")
    public ResponseResult loginOrRegister(@RequestBody VerificationCodeDTO verificationCodeDTO){
        return userService.loginOrRegister(verificationCodeDTO.getPassengerPhone());
    }

    @GetMapping("/user/{passengerPhone}")
    public ResponseResult getUserInfo(@PathVariable("passengerPhone") String passengerPhone){
        return userService.getUserByPhone(passengerPhone);
    }
}
